﻿Public Class frmMain

    Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click
        Try
            Me.Close()
        Catch ex As Exception
            MessageBox.Show("Errors: " + ex.ToString)
        End Try
    End Sub

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            dbconnection.OpenConnection()
        Catch ex As Exception
            MessageBox.Show("Errors: " + ex.ToString)
        End Try
    End Sub

    Private Sub CustomerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomerToolStripMenuItem.Click
        Try
            For Each c As Control In Me.pnBody.Controls
                c.Hide()
            Next
            With frmProType
                .FormBorderStyle = Windows.Forms.FormBorderStyle.None
                .TopLevel = False
                .Dock = DockStyle.Fill
                Me.pnBody.Controls.Add(frmProType)
                .Show()
            End With
        Catch ex As Exception
            MessageBox.Show("Errors: " + ex.ToString)
        End Try
    End Sub

    Private Sub ProductCategoryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductCategoryToolStripMenuItem.Click
        Try
            For Each c As Control In Me.pnBody.Controls
                c.Hide()
            Next
            With frmCategory
                .FormBorderStyle = Windows.Forms.FormBorderStyle.None
                .TopLevel = False
                .Dock = DockStyle.Fill
                Me.pnBody.Controls.Add(frmCategory)
                .Show()
            End With
        Catch ex As Exception
            MessageBox.Show("Errors: " + ex.ToString)
        End Try
    End Sub

    Private Sub ProductsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductsToolStripMenuItem.Click
        Try
            For Each c As Control In Me.pnBody.Controls
                c.Hide()
            Next
            With frmProduct
                .FormBorderStyle = Windows.Forms.FormBorderStyle.None
                .TopLevel = False
                .Dock = DockStyle.Fill
                Me.pnBody.Controls.Add(frmProduct)
                .Show()
            End With
        Catch ex As Exception
            MessageBox.Show("Errors: " + ex.ToString)
        End Try
    End Sub

    Private Sub CustomersToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomersToolStripMenuItem.Click
        Try
            For Each c As Control In Me.pnBody.Controls
                c.Hide()
            Next
            With frmCustomer
                .FormBorderStyle = Windows.Forms.FormBorderStyle.None
                .TopLevel = False
                .Dock = DockStyle.Fill
                Me.pnBody.Controls.Add(frmCustomer)
                .Show()
            End With
        Catch ex As Exception
            MessageBox.Show("Errors: " + ex.ToString)
        End Try
    End Sub

    Private Sub VendersToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VendersToolStripMenuItem.Click
        Try
            For Each c As Control In Me.pnBody.Controls
                c.Hide()
            Next
            With frmVender
                .FormBorderStyle = Windows.Forms.FormBorderStyle.None
                .TopLevel = False
                .Dock = DockStyle.Fill
                Me.pnBody.Controls.Add(frmVender)
                .Show()
            End With
        Catch ex As Exception
            MessageBox.Show("Errors: " + ex.ToString)
        End Try
    End Sub

    Private Sub StoreToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StoreToolStripMenuItem.Click
        Try
            For Each c As Control In Me.pnBody.Controls
                c.Hide()
            Next
            With frmStore
                .FormBorderStyle = Windows.Forms.FormBorderStyle.None
                .TopLevel = False
                .Dock = DockStyle.Fill
                Me.pnBody.Controls.Add(frmStore)
                .Show()
            End With
        Catch ex As Exception
            MessageBox.Show("Errors: " + ex.ToString)
        End Try
    End Sub

End Class